package com.roadjava.GDOUGym.interceptor;

import com.roadjava.GDOUGym.bean.entity.RecordDO;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class interceptor23 implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

        RecordDO recordDO = (RecordDO) request.getSession().getAttribute("login");

        System.out.println("recordDO = " + recordDO);
        if (recordDO == null || recordDO.getPermissionID() != 11 && recordDO.getPermissionID() != 25 && recordDO.getPermissionID() != 23) {
            response.sendRedirect(request.getContextPath() + "/tologin.jsp");
            return false;
        }
        return true;
    }
}
